/*
 * Created: 2022-07-03 00:32:58
 * Author : 涛涛涛
 */

import { useMemo } from 'react';
import classNames from 'classnames';
/** 最基础的类名称 */
export const useClassName = (
    //刚需的名称,组件名
    compName: string,
    //组件的props,里面可能包含有父组件传入的className
    userClassName?: string,
    //其它的,用户可能设置的动态类样式
    otherClassName?: { [name in string]: any }
) => {
    const className = useMemo(() => {
        return classNames(compName, {
            [userClassName]: userClassName,
            ...otherClassName,
        });
    }, [compName, userClassName, otherClassName]);

    return className;
};
